from django.contrib import admin
from django.contrib.admin.models import LogEntry

import lucky
from lucky.models import *
# 注册模型
# 注册模型变更 python manage.py makemigrations
# 创建表结构 python manage.py migrate
@admin.register(UserInfo)
class UserInfoAdmin(admin.ModelAdmin):
  # 需要显示的字段信息
  list_display = ('id', 'username', 'email', 'phone','real_name','last_login','date_joined')
@admin.register(FirstMenu)
class FirstMenuAdmin(admin.ModelAdmin):
  list_display = ('id', 'firstmenu', 'iconclass', 'created_at')
@admin.register(SecondMenu)
class SecondMenuAdmin(admin.ModelAdmin):
  list_display = ('id', 'secondmenu', 'iconclass','firstmenu', 'created_at')
@admin.register(ThirdMenu)
class ThirdMenuAdmin(admin.ModelAdmin):
  list_display = ('id', 'thirdmenu', 'iframesrc','secondmenu', 'created_at')
@admin.register(Config)
class ConfigAdmin(admin.ModelAdmin):
  list_display = ( 'para', 'desc','value')
@admin.register(ChartLog)
class ChartLogAdmin(admin.ModelAdmin):
  list_display = ( 'id', 'question','answer', 'created_at')

@admin.register(LogEntry)
class LogEntryAdmin(admin.ModelAdmin):
  list_display = ['action_time', 'user', 'content_type', '__str__']
  list_display_links = ['action_time']
  list_filter = ['action_time', 'content_type', 'user']
  readonly_fields = ['action_time', 'user', 'content_type', 'object_id', 'object_repr', 'action_flag', 'change_message']

#书籍相关
@admin.register(EbookSrc)
class EbookSrcAdmin(admin.ModelAdmin):
  # 需要显示的字段信息
  list_display = ('srcid', 'srcname', 'srcurl','listurl')

#  电子书分类
@admin.register(EbookType)
class EbookTypeAdmin(admin.ModelAdmin):
  # 需要显示的字段信息
  list_display = ('typeid', 'typeid', 'name')

# 电子书库
@admin.register(EbookStore)
class EbookStoreAdmin(admin.ModelAdmin):
  # 需要显示的字段信息
  list_display = ('storeid', 'srcid', 'typeid', 'bookno', 'bookname', 'bookstatus','bookimg', 'booknum',
                  'auto', 'update', 'score', 'booksyno', 'bookdetail', 'clicktime', 'clicknum', 'addtime')

#  电子书分类
@admin.register(EbookChapter)
class EbookChapterAdmin(admin.ModelAdmin):
  # 需要显示的字段信息
  list_display = ('id','storeid', 'srcid', 'typeid','chapurl','chapternum','chaptertitle','content','addtime')

#  视频上传工具
@admin.register(VideoTool)
class VideoToolAdmin(admin.ModelAdmin):
  # 需要显示的字段信息
  list_display = ('id','pcmac', 'date_end')
# admin.site.register([UserInfo,Redis,FirstMenu,SecondMenu,ThirdMenu])